<template>
  <div id="app">
    {{count}} <br>
    <button @click="asyncAdd">asyncAdd</button>
  </div>
</template>

<script>
  export default {
    name: 'App',
    //仓库中的数据在组件上最好使用一个计算属性与之对应
    computed:{
      count(){
        return this.$store.state.count
      }
    },
    methods:{
      //修改仓库中的数据 得通过仓库提供的工具来进行修改
      asyncAdd(){
        this.$store.dispatch("asyncAdd",{msg:"asyncAdd ---"})
      }
    }
  }
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
